package com.ldc.commonlibs.ui;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewbinding.ViewBinding;

/**
 * @author liudc
 * @since 2022/7/3 13:36
 */
public abstract class VFragmentBase<VB extends ViewBinding> extends FragmentBase {
    protected VB viewBinding;

    @Override
    protected View getLayoutView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) {
        viewBinding = loadingViewBinding(inflater, container);
        return viewBinding.getRoot();
    }

    /**
     * 加载viewBinding
     *
     * @return VB
     */
    protected VB loadingViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) {
        return initViewBinding(inflater, container);
    }

    protected abstract VB initViewBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup container);
}
